package com.smart.community.order.service.impl;

import com.smart.community.common.utils.CommonBeanutils;
import com.smart.community.order.common.dto.CartDTO;
import com.smart.community.order.enmtity.Carts;
import com.smart.community.order.mapper.CartsMapper;
import com.smart.community.order.service.CartsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhangwei
 */
@Service
public class CartsServiceImpl implements CartsService {
    @Resource
    private CartsMapper cartsMapper;

    /**
     * 通过购物车ID查询购物车商品列表信息
     *
     * @param cartsList
     * @return
     */
    @Override
    public List<CartDTO> batchCarts(List<Long> cartsList) {
        List<Carts> carts = cartsMapper.selectBatchIds(cartsList);
        return CommonBeanutils.convertListTo(carts, CartDTO::new);
    }
}
